#ifndef USERMANAGEMENTPANEL_H
#define USERMANAGEMENTPANEL_H

#include <QWidget>

class QTableWidget;
class QPushButton;
class QLabel;

// Forward declare the C struct
struct UserNode;

class UserManagementPanel : public QWidget
{
    Q_OBJECT
public:
    explicit UserManagementPanel(QWidget *parent = nullptr);
    ~UserManagementPanel(); // Destructor to free user list if needed

private slots:
    void loadUsers();
    void addUser();
    void editUser();
    void deleteUser();

private:
    void setupUi();
    void populateTable();
    void clearTable();

    QTableWidget* userTable;
    QPushButton* btnAdd;
    QPushButton* btnEdit;
    QPushButton* btnDelete;
    QPushButton* btnRefresh; // Added refresh button
    QLabel* lblUserCount;

    UserNode* userListHead = nullptr; // Keep a copy of the loaded user list
    void freeUserList(); // Helper to free the list
};

#endif // USERMANAGEMENTPANEL_H